package com.am.mosl.cityandroid.util;

import android.content.Context;

import com.am.mosl.cityandroid.bean.City;

/**
 * Created by mosl on 14-8-5.
 */
public class CityPerferenceUtil {


    public static String CIYT_LATEREST_ID="CIYT_LATEREST_ID";
    public static String CITY_LATEREST_CITY="CIYT_LATEREST_CITY";


    public static City getLaterestCity(Context context){

        City city=new City();
        city.setId(PreferencesUtils.getInt(context,CIYT_LATEREST_ID,-100));
        city.setCity(PreferencesUtils.getString(context,CITY_LATEREST_CITY,"null"));

        return city;
    }


    public static void putLaterestCity(Context context,City city){

        if(city.getId()<0){
            return;
        }
        PreferencesUtils.putInt(context,CIYT_LATEREST_ID,city.getId());
        PreferencesUtils.putString(context,CITY_LATEREST_CITY,city.getCity());

    }
}
